package com.gary.springcloud.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author peng_rui
 * @date 2023/2/13
 */
@Getter
@AllArgsConstructor
public enum StatusEnum {

    ADDING(0, "创建中"),
    SUCCESS(1, "完成"),
    ;
    private Integer code;
    private String description;

    /**
     * 根据code 获取描述
     * @param code
     * @return
     */
    public static String getMsg(Integer code){
        for (StatusEnum value : StatusEnum.values()) {
            if(value.code.equals(code)){
                return value.description;
            }
        }
        return null;
    }
}
